package www.sofn.com.goods.domain.po;


import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;
import www.sofn.com.domain.pojo.BasePO;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

@Data
@ToString
@Accessors(chain = true)
@TableName(value = "goods", autoResultMap = true)
public class GoodsPO extends BasePO {

    private String goodsName; //商品名称
    private String goodsCarousel; //商品轮播
    @TableField(typeHandler = JacksonTypeHandler.class)
    private GoodsAttr goodsAttr; //商品属性
    private LocalDateTime publishDate;//发布时间
    private String goodsInfoImg;//商品详情图片
    @TableField(typeHandler = JacksonTypeHandler.class)
    private List<GoodsSpecs> goodsSpecs;

    //商品规格
    @Data
    @Accessors(chain = true)
    @ToString
    public static class GoodsSpecs {
        private String k;
        private String v;
    }

    @Data
    @Accessors(chain = true)
    @ToString
    public static class GoodsAttr {
        private String attrName; //属性名称
        private List<AttrInfo> attrValue;
    }

    @Data
    @Accessors(chain = true)
    @ToString
    public static class AttrInfo {
        private Long id;
        private String value; // 属性值
        private String img; //属性图片
        private BigDecimal memberPrice; //会员价格
        private BigDecimal marketPrice;//市场价格
        private Integer inventory;  //库存
    }
}
